package com.itheima.d2_string.demo;

import java.util.Scanner;

/**
 * 操作类
 */
public class AdminOperator {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for(int i = 0;i < 3; i++) {
            System.out.println("请输入你的用户名：");
            String name = sc.next();
            System.out.println("请输入你的密码：");
            String password = sc.next();
            AdminOperator Operator = new AdminOperator();
            if(Operator.TestPassword(name, password)){
                System.out.println("欢迎进入系统");
                break;
            }else{
                System.out.println("您输入的用户名或密码错误，请重新输入");
            }
        }


    }
    public boolean TestPassword(String name ,String password) {
        if(name.equals("itheima") && password.equals("123456")) {
//            System.out.println("欢迎进入系统");
            return true;
        }
        else {
//            System.out.println("您的输入有误");
            return false;
        }
    }

}
